<%@ tag language="java" pageEncoding="UTF-8" body-content="empty"%>
<%@ attribute description="分页视图对象" name="page" type="com.yh.vo.PageVO"
	required="true" rtexprvalue="true"%>
<%@ attribute description="显示页面的数量,默认：5" name="max"
	type="java.lang.Integer" required="false" rtexprvalue="true"%>
<%@ attribute description="分页超链接的地址，占位符{page},默认：javascript:void(0);"
	name="url" type="java.lang.String" required="false" rtexprvalue="true"%>

<%--标签文件
导入标签库文件夹：<%@ taglib tagdir="/WEB-INF/tags/" prefix="my" %>
标签的使用和普通自定义标签一致：<my:page page="${p }" url="admin/user-list-3.let? key=${param.key }&current={page}" max="7"/>
 --%>

<%
	if (page == null || page.getTotal() == 0) {
		return;
	}

	if (max == null) {
		max = 5;
	}
	if (url == null) {
		url = "javascript:void(0);";
	}
%>
<ul class="pagination justify-content-center">
	<li class="page-item"><a class="page-link" data-page="1"
		href="<%=url.replace("{page}", "1")%>" aria-label="Previous"> <span
			aria-hidden="true">&laquo;</span>
	</a></li>
	<%
		String active = "";
		for (Object i : page.getPages(max)) {
			active = "";
			if ((int) i == page.getCurrent()) {
				active = " active";
			}
	%>
	<li class="page-item <%=active%>"><a class="page-link"
		data-page="<%=i%>" href="<%=url.replace("{page}", i.toString())%>"><%=i%></a></li>
	<%
		}
	%>

	<li class="page-item"><a class="page-link"
		data-page="<%=page.getPageMax()%>"
		href="<%=url.replace("{page}", "" + page.getPageMax())%>"
		aria-label="Next"> <span aria-hidden="true">&raquo;</span>
	</a></li>
</ul>